package com.ims.core.doc.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ims.common.annotation.Log;
import com.ims.common.core.controller.BaseController;
import com.ims.common.core.domain.AjaxResult;
import com.ims.common.enums.BusinessType;
import com.ims.core.doc.domain.TInNon1013;
import com.ims.core.doc.service.ITInNon1013Service;
import com.ims.common.utils.poi.ExcelUtil;
import com.ims.common.core.page.TableDataInfo;

/**
 * 1013 通用（电子）发票Controller
 *
 * @author IMS
 * @date 2024-11-25
 */
@RestController
@RequestMapping("/doc/tongyongdianzi")
public class TInNon1013Controller extends BaseController
{
    @Autowired
    private ITInNon1013Service tInNon1013Service;

    /**
     * 查询1013 通用（电子）发票列表
     */
    @PreAuthorize("@ss.hasPermi('doc:tongyongdianzi:list')")
    @GetMapping("/list")
    public TableDataInfo list(TInNon1013 tInNon1013)
    {
        startPage();
        List<TInNon1013> list = tInNon1013Service.selectTInNon1013List(tInNon1013);
        return getDataTable(list);
    }

    /**
     * 导出1013 通用（电子）发票列表
     */
    @PreAuthorize("@ss.hasPermi('doc:tongyongdianzi:export')")
    @Log(title = "1013 通用（电子）发票", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TInNon1013 tInNon1013)
    {
        List<TInNon1013> list = tInNon1013Service.selectTInNon1013List(tInNon1013);
        ExcelUtil<TInNon1013> util = new ExcelUtil<TInNon1013>(TInNon1013.class);
        util.exportExcel(response, list, "1013 通用（电子）发票数据");
    }

    /**
     * 获取1013 通用（电子）发票详细信息
     */
    @PreAuthorize("@ss.hasPermi('doc:tongyongdianzi:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tInNon1013Service.selectTInNon1013ById(id));
    }

    /**
     * 新增1013 通用（电子）发票
     */
    @PreAuthorize("@ss.hasPermi('doc:tongyongdianzi:add')")
    @Log(title = "1013 通用（电子）发票", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TInNon1013 tInNon1013)
    {
        return toAjax(tInNon1013Service.insertTInNon1013(tInNon1013));
    }

    /**
     * 修改1013 通用（电子）发票
     */
    @PreAuthorize("@ss.hasPermi('doc:tongyongdianzi:edit')")
    @Log(title = "1013 通用（电子）发票", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TInNon1013 tInNon1013)
    {
        return toAjax(tInNon1013Service.updateTInNon1013(tInNon1013));
    }

    /**
     * 删除1013 通用（电子）发票
     */
    @PreAuthorize("@ss.hasPermi('doc:tongyongdianzi:remove')")
    @Log(title = "1013 通用（电子）发票", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tInNon1013Service.deleteTInNon1013ByIds(ids));
    }
}
